package com.xjrsoft.module.workflow.listener;


import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.delegate.TaskListener;
import org.flowable.task.service.delegate.DelegateTask;
import org.springframework.stereotype.Component;

//会签任务监听
@Slf4j
@Component
public class TaskCompleteListener implements TaskListener {


    @Override
    public void notify(DelegateTask delegateTask) {
        if ("complete".equals(delegateTask.getEventName())) {
            // 通过人数
            Long completeCount =Long.valueOf(String.valueOf(delegateTask.getVariable("completeCount")));
            String btnValue = (String) delegateTask.getVariable("btnValue");
            if ("agree_".equals(btnValue)) {
                delegateTask.setVariable("completeCount", completeCount + 1);
            }
            log.info("btnValue:" + btnValue);
            log.info("count=" + completeCount + 1);
            log.info("CompleteListener*********************************************  监听器监听！！！eventName：" + delegateTask.getEventName());
        }
        log.info("CompleteListener out*********************************************  监听器监听！！！eventName：" + delegateTask.getEventName());
    }
}
